# 导包
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
# 获取浏览器驱动对象
driver = webdriver.Firefox()
# 打开网页
url = 'file:///D:/nsd2404/html/registerA.html'
driver.get(url)
# 使用CSS定位用户名对应的文本框
# username = driver.find_element(By.CSS_SELECTOR, '#userA')
username = driver.find_element(By.CSS_SELECTOR, '#p1>input')
username.send_keys('admin')
# 练习：通过ID选择器定位密码框，通过class选择器定位电话号码，通过属性选择器定位邮箱
password = driver.find_element(By.CSS_SELECTOR, '#passwordA')
password.send_keys('123456')
tel = driver.find_element(By.CSS_SELECTOR, '.telA')
tel.send_keys('13888888888')
email = driver.find_element(By.CSS_SELECTOR, '[id$="ilA"]')
email.send_keys('123@163.com')

# 3秒关闭驱动
sleep(3)
driver.quit()